package com.becca.cake.dao.goods;

import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;

import com.becca.cake.model.coupon.GoodsActivityModel;
import com.becca.cake.model.goods.GoodsDetailModel;
import com.becca.cake.model.goods.GoodsLableModel;
import com.becca.cake.model.goods.GoodsModel;
import com.becca.cake.model.goods.GoodsPictureModel;
import com.becca.cake.model.goods.GoodsPriceSizeModel;
import com.becca.cake.model.goods.GoodsPriceSizeTreeModel;
import com.becca.cake.model.goods.GoodsTreeModel;

/**
 * 商品管理Dao层接口
 * @copyright  尊星(上海)信息科技有限公司
 * @author yellow
 * @date 2016年5月18日 下午9:18:28
 */
@Repository
public interface GoodsDAO {
    /**
     * 查询所有商品
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<GoodsModel> selectGoods(Map<String, Object> map) throws DataAccessException;

    /**
     * 
     * 获取商品数据总条数
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long selectGoodsCount(Map<String, Object> map) throws DataAccessException;

    /**
     * 
     * 获取配件数据总条数
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long selectPartsCount(Map<String, Object> map) throws DataAccessException;

    /**
     * 添加商品信息
     * @param goodsModel
     * @throws DataAccessException
     */
    void insertGoods(GoodsModel goodsModel) throws DataAccessException;

    /**
     * 修改商品/配件信息
     * @param goodsModel
     * @throws DataAccessException
     */
    void updateGoods(GoodsModel goodsModel) throws DataAccessException;

    /**
     * 下架商品
     * @param id
     * @throws DataAccessException
     */
    void updGoodsStatusById(Map<String, Object> map) throws DataAccessException;

    /**
     * 根据商品编号查找商品对象
     * @param goodsId
     * @return
     * @throws DataAccessException
     */
    GoodsModel selectGoodsById(Integer goodsId) throws DataAccessException;

    /**
     * 根据商品ID查询商品PriceSize
     * @param goodsId
     * @return
     * @throws DataAccessException
     */
    List<GoodsPriceSizeModel> queryGoodsPriceSizeByGoodsId(Map<String, Object> map)
                                                                                   throws DataAccessException;

    /**
     * 
     * 获取商品价格大小数据总条数
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long queryGoodsPriceSizeCount(Map<String, Object> map) throws DataAccessException;

    /**
     * 添加商品/配件价格大小信息
     * @param goodsModel
     * @throws DataAccessException
     */
    void insertGoodsPriceSize(GoodsPriceSizeModel goodsPriceSizeModel) throws DataAccessException;

    /**
     * 修改商品/配件价格大小信息
     * @param goodsModel
     * @throws DataAccessException
     */
    void updateGoodsPriceSize(GoodsPriceSizeModel goodsPriceSizeModel) throws DataAccessException;

    /**
     * 根据商品尺寸编号查找商品对象
     * @param id
     * @return
     * @throws DataAccessException
     */
    GoodsPriceSizeModel selectGoodsPriceSizeModelById(Integer id) throws DataAccessException;

    /**
     * 修改isDelete
     * @param map
     * @throws DataAccessException
     */
    void updIsDelete(Map<String, Object> map) throws DataAccessException;

    /**
     * 
     * 获取商品图片数据总条数
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long queryGoodsPicCount(Map<String, Object> map) throws DataAccessException;

    /**
     * 添加商品/配件图片信息
     * @param goodsModel
     * @throws DataAccessException
     */
    void insertGoodsPic(GoodsPictureModel goodsPictureModel) throws DataAccessException;

    /**
     * 修改商品/配件图片信息
     * @param goodsModel
     * @throws DataAccessException
     */
    void updateGoodsPic(GoodsPictureModel goodsPictureModel) throws DataAccessException;

    /**
     * 根据商品图片编号查找图片对象
     * @param id
     * @return
     * @throws DataAccessException
     */
    GoodsPictureModel selectGoodsPicById(Integer id) throws DataAccessException;

    /**
     * 修改商品图片isDelete
     * @param map
     * @throws DataAccessException
     */
    void updGoodsPicIsDelete(Map<String, Object> map) throws DataAccessException;

    /**
     * 判断是否存在该商品尺寸
     * @param goodsPriceSizeModel
     * @return
     * @throws DataAccessException
     */
    Long isExistGPS(GoodsPriceSizeModel goodsPriceSizeModel) throws DataAccessException;

    /**
     * 判断是否已删除该商品尺寸
     * @param goodsPriceSizeModel
     * @return
     * @throws DataAccessException
     */
    Long isDeleteGPS(Map<String, Object> map) throws DataAccessException;

    /**
     * 验证该图片是否已删除
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long isDeleteGoodsPic(Map<String, Object> map) throws DataAccessException;

    /**
     * 查询商品图片
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<GoodsPictureModel> queryGoodsPics(Map<String, Object> map) throws DataAccessException;

    /**
     * 获取商品图片总条数
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long queryGoodsPicsCount(Map<String, Object> map) throws DataAccessException;

    /**
     * 添加商品时设置商品编码
     * @param map
     * @throws DataAccessException
     */
    void updGoodsCode(Map<String, Object> map) throws DataAccessException;

    /**
     * 添加商品详情
     * @param insertGoodsDtail
     * @throws DataAccessException
     */
    void insertGoodsDetail(GoodsDetailModel goodsDetailModel) throws DataAccessException;

    /**
     * 修改商品详情
     * @param goodsDetailModel
     * @throws DataAccessException
     */
    void updateGoodsDetail(GoodsDetailModel goodsDetailModel) throws DataAccessException;

    /**
     * 验证该商品是否 未上架、已上架、已下架
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long isGoodsStatusExist(Map<String, Object> map) throws DataAccessException;

    /**
     * 添加商品尺寸时设置商品规格编码
     * @param goodsPriceSizeId
     * @throws DataAccessException
     */
    void updGoodsStandardCode(Map<String, Object> map) throws DataAccessException;

    /**
     * 批量修改排序
     * @param map
     * @throws DataAccessException
     */
    void updateGoodsPicOrders(List<GoodsPictureModel> list) throws DataAccessException;

    /**
     * 查询商品活动列表
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<GoodsActivityModel> selectGoodsActivity(Map<String, Object> map)
                                                                         throws DataAccessException;

    /**
     * 
     * 获取商品活动数据总条数
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long selectGoodsActivityCount(Map<String, Object> map) throws DataAccessException;

    /**
     * 添加商品活动
     * @param insertGoodsDtail
     * @throws DataAccessException
     */
    void insertGoodsActivity(GoodsActivityModel goodsActivityModel) throws DataAccessException;

    /**
     * 修改商品活动
     * @param goodsDetailModel
     * @throws DataAccessException
     */
    void updateGoodsActivity(GoodsActivityModel goodsActivityModel) throws DataAccessException;

    /**
     * 根据商品活动ID查询商品活动对象
     * @param id
     * @throws DataAccessException
     */
    GoodsActivityModel selectGoodsActivityUpdById(Integer id) throws DataAccessException;

    /**
     * 查询商品Tree节点
     * @param goodsStatus
     * @return
     * @throws DataAccessException
     */
    List<GoodsTreeModel> selectGoodsTree(Integer goodsStatus) throws DataAccessException;

    /**
     * 查询商品规格Tree节点
     * @param goodsId
     * @return
     * @throws DataAccessException
     */
    List<GoodsPriceSizeTreeModel> selectGoodsPriceSizeTree(Map<String, Object> map)
                                                                                   throws DataAccessException;

    /**
     * 商品排序修改
     * @param list
     */
    void updateGoodsOrder(Map<String, Object> paramMap);
    
    
    /**
     *  查询标签商品数据
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<GoodsLableModel> selectGoodsLable(Map<String, Object> map) throws DataAccessException;
    
    /**
     *  查询标签数据
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<GoodsLableModel> selectLable(Map<String, Object> map) throws DataAccessException;

    /**
     * 获取查询标签总条数
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long selectLableCount(Map<String, Object> map) throws DataAccessException;
    
    /**
     * 获取查询标签商品总条数
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long selectGoodsLableCount(Map<String, Object> map) throws DataAccessException;

    /**
     * 添加标签信息
     * @param goodsLableModel
     * @throws DataAccessException
     */
    void insertGoodsLable(GoodsLableModel goodsLableModel) throws DataAccessException;

    /**
     * 修改标签信息
     * @param goodsLableModel
     * @throws DataAccessException
     */
    void updateGoodsLable(GoodsLableModel goodsLableModel) throws DataAccessException;

    /**
     * 修改标签状态
     * @param map
     * @throws DataAccessException
     */
    void updateGoodsLableStatus(Map<String, Object> map) throws DataAccessException;

    /**
     * 根据id查询标签信息
     * @param goodsLableId
     * @return
     * @throws DataAccessException
     */
    GoodsLableModel selectGoodsLableById(Integer goodsLableId) throws DataAccessException;
    
    /**
     * 根据商品id查询标签信息
     * @param goodsId
     * @return
     * @throws DataAccessException
     */
    GoodsLableModel selectLableByGoodsId(Integer goodsId) throws DataAccessException;
    
    /**
     * 查询标签中是否已存在此商品
     * @param goodsLableModel
     * @return
     * @throws DataAccessException
     */
    Long selectIsLableGoodsExsit(GoodsLableModel goodsLableModel) throws DataAccessException;
    
    /**
     * 删除标签商品应用
     * @param id
     * @throws DataAccessException
     */
    void deleteGoodsLableById(Integer id)  throws DataAccessException;
}
